$(function() {
	var goodsIdForModify = document.getElementById("goodsIdForModify").value;
	if(goodsIdForModify==""){
		document.getElementById("content").style.display='none';
	}else{
		document.getElementById("content").style.display='';
		 var t = $('#content').offset().top-120;
	     $(window).scrollTop(t);
	}
	var initflag = document.getElementById("initFlag").value;
	if(initflag=="2"){
		document.getElementById("content1").style.display='';
	}else{
		document.getElementById("content1").style.display='none';
	}
	
	$("#addResourceInitBt").click(function() {
		$("#content1").css('display','block'); 
		$("#content").css('display','none'); 
	    var t = $('#content1').offset().top;
        $(window).scrollTop(t);
		$("#goodsIdForModify").val("");
	}
	)
	$("#confirm").click(function() {
		init();
		var resourceTypeId=$("#resourceTypeId").val();
		var fileFileName=$("#fileFileName").val();
		
		document.forms[0].action = "../webgoods/addResourceInfo.action?resourceTypeId="+resourceTypeId+"&fileFileName="+fileFileName;
		document.forms[0].submit();
	});
	
	
	$("#updateConfirm").click(function() {
		init();
		var goods_img=$("#goods_img").val();
		var goods_id=$("#goods_id").val();
	
		document.forms[0].action = "../webgoods/updateResourceInfo.action?goods_img="+goods_img+"&goods_id="+goods_id;
		document.forms[0].submit();
	});
	

	/*$(".addResource").click(function() {
		
		$("#content").css('display','block'); 
		$("#goodsIdForModify").val("");
		$("#languageIdForModify").val("");
		$("#price").val("");
		//説明
		$("#descriptionx").val("");
		$("#statusForResource").val("0");
		
	});*/
	
	$(".resourceInfoInit").click(function() {
		$("#content").css('display','block'); 
		
		var resourceTypeId=$(this).next().val();
		document.forms[0].action = "../webgoods/modifyResourceInfoInit.action?resourceTypeId=" + resourceTypeId;
		document.forms[0].submit();
		return false;
	});
	
});

function init(){
	if($('input:radio[name="statusForResource"]:checked')){
		var radioValue=$('input:radio[name="statusForResource"]:checked').val();
		$("#status").val(radioValue);
	}
}